<template>
    <a :href="url"><p>如果沒有启动，请点此启动</p></a>
</template>

<script>
    export default {
        props:['scheme','url'],
        mounted: function () {


                    if(this.isWeiXin()){
                    window.open(this.url,'_self','');  
                    }else{
                    window.open(this.scheme,'_self','');
                    }

                },
        
        methods: {

            isWeiXin:function () {
                var ua = window.navigator.userAgent.toLowerCase();
                console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1
                if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                return true;
                } else {
                return false;
                }
            } 
            
        }
    }
</script>